package com.sun.springboot_mq_ack1.receiver;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**系消费者
 * @author shkstart
 * @create 2021-10-27 17:03
 */
@Component
@Slf4j
public class WarningConsumer {
    /**
     * 报警队列
     */
    public static final String WARNING_QUEUE_NAME = "warning_queue";
    /**
     * 队列
     */
    public static final String CONFIRM_QUEUE_NAME = "confirm_queue";
    @RabbitListener(queues = WARNING_QUEUE_NAME)
    public void receiveWarningMsg(Message message, Channel channel) {
        String msg = new String(message.getBody());
        log.error(" 报警对列接收到消息：{}", msg);
    }
    @RabbitListener(queues = CONFIRM_QUEUE_NAME)
    public void receiveWarningMsg1(Message message, Channel channel) {
        String msg = new String(message.getBody());
        log.error(" 确认队列接收到消息：{}", msg);
    }
}
